home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / mail / thor201.lha / THOR_2.0 / thor.lha / rexx / StealTagline.thor < prev    next >
Text File  |  1995-05-15  |  2KB  |  80 lines

  1. /*
  2. **  $VER: 1.5 (17.2.95)
  3. **
  4. **  StealTagline.thor
  5. **
  6. **  Steals taglines from the current message
  7. **
  8. **  Author: Magne Østlyngen
  9. **
  10. **  (C)1994-1995 Ultima Thule Software
  11. */
  12.  
  13. options results
  14.  
  15. p=address()||' '||show('P',,);if pos('THOR.',p)>0 then thorport=word(,
  16. substr(p,pos('THOR.',p)),1);else do;say 'No THOR port found!';exit 10;end
  17.  
  18. if ~show('p','BBSREAD') then do;address command;
  19. "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead";"WaitForPort BBSREAD";end
  20.  
  21. address(thorport)
  22. CURRENTMSG STEM msg
  23. if rc~=0 then error('"CURRENTMSG failed: '||THOR.LASTERROR||'"')
  24.  
  25. address BBSREAD
  26. READBRMESSAGE '"'||msg.bbsname||'"' '"'||msg.confname||'"' msg.msgnr HEADSTEM head TEXTSTEM text
  27. if rc~=0 then error('"READBRMESSAGE failed: '||BBSREAD.LASTERROR||'"')
  28.  
  29. drop txt.
  30. n=text.text.count
  31. do while text.text.n="";n=n-1;end
  32. text.text.count=n
  33. nl=0;do n=1 to text.text.count;if text.text.n=""then nl=n;end
  34. txt.count=text.text.count-nl
  35. n=1;do i=nl+1 to text.text.count;txt.n=text.text.i;n=n+1;end
  36.  
  37. address(thorport)
  38. drop out.
  39. REQUESTLIST txt out '"Select lines to steal"' DRAGSELECT SIZEGADGET
  40. if rc=5 then exit
  41. if rc~=0 then error('"REQUESTLIST failed: '||THOR.LASTERROR||'"')
  42. if out.count=0 then exit
  43.  
  44. address BBSREAD
  45. GETCONFDATA '"'||msg.bbsname||'" "'||msg.confname||'"' conf
  46. if rc~=0 then error('"GETCONFDATA failed: '||BBSREAD.LASTERROR||'"')
  47. tagf=conf.tagfile
  48. if(symbol("conf.tagfile")~="VAR")|(conf.tagfile="")then do
  49.     GETBBSDATA '"'||msg.bbsname||'"' bbs
  50.     if rc~=0 then error('"GETBBSDATA failed: '||BBSREAD.LASTERROR||'"')
  51.     tagf=bbs.tagfile
  52.     if(symbol("bbs.tagfile")~="VAR")|(bbs.tagfile="")then do
  53.         GETGLOBALDATA glob
  54.         if rc~=0 then error('"GETGLOBALDATA failed: '||BBSREAD.LASTERROR||'"')
  55.         tagf=glob.tagfile
  56.         if(symbol("glob.tagfile")~="VAR")|(glob.tagfile="")then error('"No tagfile configured"')
  57.     end
  58. end
  59.  
  60. address command "echo noline >>"||tagf
  61.  
  62. if ~open(fil,tagf,A)then error('"Couldn'||"'"||'t open tagfile to append new tag"')
  63.  
  64. tagline=""
  65. do n=1 to out.count
  66.     tagline=tagline||out.n
  67.     if n~=out.count then tagline=tagline||'\n'
  68. end
  69. call writeln(fil,tagline)
  70. call close(fil)
  71. exit
  72.  
  73.  
  74. error:
  75. parse arg err
  76. address(thorport)
  77. say REQUESTNOTIFY err '"_Ok"'
  78. REQUESTNOTIFY err '"_Ok"'
  79. exit
  80.